using System;
using System.Collections.Generic;
using System.Text;
using Db4o.Framework.Configuration;

namespace Db4o.Framework
{
    internal class RemoteConnexionStrategy : ConnexionStrategy
    {
        public RemoteConnexionStrategy(string _host, int _port, string _user, string _pass)
        {
            Host = _host;
            Port = _port;
            User = _user;
            Password = _pass;

        }

        private string host;

        public string Host
        {
            get { return host; }
            set { host = value; }
        }
        private int port;

        public int Port
        {
            get { return port; }
            set { port = value; }
        }
        private string user;

        public string User
        {
            get { return user; }
            set { user = value; }
        }
        private string password;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public override void Connect()
        {
            Connect(
                AssemblySettings.Default["Host"],
                Int32.Parse(AssemblySettings.Default["Port"]),
                AssemblySettings.Default["User"],
                AssemblySettings.Default["Pass"]
            );
        }
        public void Connect(string host, int port, string user, string password)
        {
            DataManager.Instance.OpenRemoteConnexion(host,port,user,password);
        }
    }
}
